class Cat:
    """
    构造方法
    """
    def __init__(self):
        print("这是一个初始化方法")
        self.name = "name"


tom_cat = Cat()  # 自动调用__init__方法
print(tom_cat.name)


class Dog:
    """
    构造方法
    """
    def __init__(self, name, age):
        self.name = name
        self.age = age


dog = Dog("小黑", 11)
print(dog.name)
print(dog.age)
